#include <stdio.h>
/*int main() {
    FILE *fp;
    fp=fopen("file.txt","r+");
    if(NULL == fp)
    {
        perror("fopen fail");//定位失败原因
        return -1;
    }
    char c;
*//*    char c=fgetc(fp);
    printf("%c",c);*//*
    while((c=fgetc(fp))!=EOF)
    {
        printf("%c",c);
    }
    c=fputc('H',fp);
    if(NULL==c)
    {
        perror("fputc fail:");
        return -1;
    }
    fclose(fp);
    return 0;
}*/
#include<string.h>

/*int main()
{
    char buf[20]="hello\nworld";
    FILE *fp;
    int ret;
    fp=fopen("file.txt","r+");
    if(NULL == fp)
    {
        perror("fopen fail:");
        return 0;
    }
    //int n=fwrite(buf,sizeof(char),strlen(buf),fp);  //写入
    //printf("%d",n);
    char newbuf[20]={0};
    int n= fread(newbuf,sizeof(char),sizeof(newbuf),fp);
    printf("%d\n%s\n",n,newbuf);
    fclose(fp);
    return 0;
}*/
/*
int main()
{
    FILE *pf;
    pf= fopen("file.txt","rb+");
    //int i=123456;
    //fwrite(&i,sizeof(int),1,pf);
    int i=0;
    fread(&i,sizeof(int),1,pf);
    printf("i=%d",i);
    return 0;
}*/
